//
//  LJLRPLocalTVC.m
//  聆听FM
//
//  Created by dllo on 16/6/8.
//  Copyright © 2016年 Dark. All rights reserved.
//

#import "LJLRPLocalTVC.h"

@implementation LJLRPLocalTVC

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.leftIV = [[UIImageView alloc] init];
        [self.contentView addSubview:_leftIV];
        self.titleL = [[UILabel alloc] init];
        self.titleL.textColor = [UIColor blackColor];
        self.titleL.font = [UIFont systemFontOfSize:15];
        [self.contentView addSubview:_titleL];
        self.programL = [[UILabel alloc] init];
        self.programL.textColor = [UIColor grayColor];
        self.programL.font = [UIFont systemFontOfSize:12];
        [self.contentView addSubview:_programL];
        self.personL = [[UILabel alloc] init];
        self.personL.textColor = [UIColor colorWithWhite:0.6 alpha:1];;
        self.personL.font = [UIFont systemFontOfSize:12];
        [self.contentView addSubview:_personL];
        self.startB = [UIButton buttonWithType:UIButtonTypeCustom];
        [self.startB setImage:[UIImage imageNamed:@"np_sound_playtimes_b"] forState:UIControlStateNormal];
        [self.startB addTarget:self action:@selector(didClickedStartOrStop) forControlEvents:UIControlEventTouchUpInside];
    }
    return self;
}
- (void)layoutSubviews
{
    [super layoutSubviews];
    self.leftIV.frame = CGRectMake(10, 10, 70, 70);
    self.titleL.frame = CGRectMake(90, 10, 175 * FITWIDTH, 30);
    self.programL.frame = CGRectMake(90, 40, 200 * FITWIDTH, 20);
    self.personL.frame = CGRectMake(90, 60, 200 * FITWIDTH, 20);
    self.startB.frame = CGRectMake(345, 35, 20, 20);
}
- (void)setModel:(LJLRadioPageModel *)model
{
    if (_model != model) {
        _model = model;
        
        [self.leftIV sd_setImageWithURL:[NSURL URLWithString:model.radioCoverLarge] placeholderImage:[UIImage sd_animatedGIFNamed:@"占位图"]];
        self.titleL.text = model.rname;
    
        if (model.programName == nil) {
            self.programL.text = [NSString stringWithFormat:@"当前没有节目"];
        }
        else
        {
        self.programL.text = [NSString stringWithFormat:@"正在直播 : %@",model.programName];
        }
        if (model.radioPlayCount > 10000) {
            self.personL.text = [NSString stringWithFormat:@"%.1f万人",model.radioPlayCount / 10000.0];

        }
        else
        {
            self.personL.text = [NSString stringWithFormat:@"%ld人", model.radioPlayCount];

        }
        
}
}
- (void)didClickedStartOrStop
{
    NSLog(@"点击");
}

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
